fix(tui): simplify sidebar toggle to respect terminal width#36414
Open
JohnXu22786 wants to merge 2 commits into
Open
fix(tui): simplify sidebar toggle to respect terminal width#36414JohnXu22786 wants to merge 2 commits into
JohnXu22786 wants to merge 2 commits into
Conversation
The sidebar visibility logic had two state variables: a persistent
`sidebar` mode ("auto" / "hide") and a local `sidebarOpen` signal.
When toggling the sidebar on via the command palette, `sidebarOpen`
was set to `true`, which overrode the terminal width check and
forced the sidebar to show even on narrow (windowed) terminals.
Remove `sidebarOpen` entirely. Sidebar visibility is now determined
solely by the persistent mode: visible only when mode is "auto"
AND the terminal is wide enough (>120 columns). The toggle command
simply switches between "auto" and "hide" modes.
Also remove the dead `!wide()` rendering branch inside the sidebar
visibility guard, since `sidebarVisible()` now requires `wide()`
to be true.
Fixes the bug where enabling sidebar in windowed mode would
force-show it on the right side, blocking content, until restart.
Contributor
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #36417
Type of change
What does this PR do?
The sidebar visibility logic had two overlapping state variables:
sidebar(persistent KV):"auto"or"hide"sidebarOpen(local signal): temporary overrideWhen toggling the sidebar ON via the command palette,
sidebarOpenwas set totrue, which overrode the terminal width check (wide()) and forced the sidebar visible regardless of screen width. This caused the sidebar to show in narrow windowed mode where it should have remained hidden, blocking content until TUI restart.This PR removes the
sidebarOpensignal entirely. Sidebar visibility is now determined solely by the persistent mode:"auto": visible only when terminal width > 120 columns"hide": never visibleThe toggle command simply switches between
"auto"and"hide"modes. Also removed the now-dead!wide()rendering branch (the overlay variant was only reachable whensidebarOpenwas true).How did you verify your code works?
packages/tui/test/session/sidebar.test.tsxcovering the core visibility logic, toggle behavior, and the regression scenariosidebarVisiblememo now correctly depends only onsidebar()andwide(), so toggling on a narrow terminal won't force-show the sidebarScreenshots / recordings
N/A - terminal UI change, not visual.
Checklist